package cn.tedu.kcircle.attachment.infra.converter;

import cn.tedu.kcircle.attachment.dao.entity.AttachDO;
import cn.tedu.kcircle.attachment.dao.entity.AttachLogDO;
import cn.tedu.kcircle.attachment.repository.model.AttachAddModel;
import cn.tedu.kcircle.attachment.repository.model.AttachLogAddModel;
import org.springframework.beans.BeanUtils;
import org.springframework.stereotype.Component;

import java.util.List;

@Component
public class AttachmentInfraConverter {

    public AttachDO model2DO(AttachAddModel attachAddModel){
        AttachDO attachDO = new AttachDO();
        BeanUtils.copyProperties(attachAddModel,attachDO);
        return attachDO;
    }
    public AttachLogDO model2DO(AttachLogAddModel attachLogAddModel){
        AttachLogDO attachLogDO = new AttachLogDO();
        BeanUtils.copyProperties(attachLogAddModel,attachLogDO);
        return attachLogDO;
    }
    public List<AttachDO> model2AttachDOS(List<AttachAddModel> attachAddModels){
        return attachAddModels.stream().map(this::model2DO).toList();
    }
    public List<AttachLogDO> model2AttachLogDOS(List<AttachLogAddModel> attachLogAddModels){
        return attachLogAddModels.stream().map(this::model2DO).toList();
    }

}
